/*
 * Copyright (c)  2015~2020, xforceplus
 * All rights reserved.
 * Project:datacare-orm
 * Id: DefaultNameConversion.java   2020-10-05 13-53-55
 * Author: Evan
 */
package cn.datacare.orm.conversion;

import cn.datacare.orm.annotation.Table;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: 2015~2020
 * </p>
 * <p>
 * Company/Department: xforceplus
 * </p>
 *
 * @author Evan
 * <b>Creation Time:</b> 2020-10-05 13-53-55
 * @since V1.0
 */
public class DefaultNameConversion extends NameConversion {

    @Override
    public String getTableName(Class<?> c) {
        Table table = (Table)c.getAnnotation(Table.class);
        if(table!=null){
            return table.name();
        }
        return c.getSimpleName();
    }

    @Override
    public String getColName(Class<?> c, String attrName) {
        return attrName;
    }

    @Override
    public String getPropertyName(Class<?> c, String colName) {
        return colName;
    }
}
